<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of VMT_PlotXSContQuiver</title>
  <meta name="keywords" content="VMT_PlotXSContQuiver">
  <meta name="description" content="This function plots the the contour plot (mean XS) for the variable 'var'">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- menu.html trunk -->
<h1>VMT_PlotXSContQuiver
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>This function plots the the contour plot (mean XS) for the variable 'var'</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [z,A,V,log_text] = VMT_PlotXSContQuiver(z,A,V,var,sf,exag,qspchorz,qspcvert,secvecvar,vvelcomp,plot_english,varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> This function plots the the contour plot (mean XS) for the variable 'var'
 and then plots quivers with secondary flow (vertical and transverse
 components) on top of the contour plot.  IF data is not supplied, user
 will be prompted to load data (browse to data).


 (adapted from code by J. Czuba)

 P.R. Jackson, USGS, 12-10-08 
 Last modified: F.L. Engel, USGS, 2/20/2013</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="VMT_PlotXSCont.html" class="code" title="function [z,A,V,zmin,zmax,log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english)">VMT_PlotXSCont</a>	Plots contours for the variable 'var' within the mean cross section given</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="VMT.html" class="code" title="function varargout = VMT(varargin)">VMT</a>	--- THE VELOCITY MAPPING TOOLBOX ---</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [z,A,V,log_text] = VMT_PlotXSContQuiver(z,A,V,var,sf,exag,qspchorz,qspcvert,secvecvar,vvelcomp,plot_english,varargin)</a>
0002 <span class="comment">% This function plots the the contour plot (mean XS) for the variable 'var'</span>
0003 <span class="comment">% and then plots quivers with secondary flow (vertical and transverse</span>
0004 <span class="comment">% components) on top of the contour plot.  IF data is not supplied, user</span>
0005 <span class="comment">% will be prompted to load data (browse to data).</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% (adapted from code by J. Czuba)</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% P.R. Jackson, USGS, 12-10-08</span>
0011 <span class="comment">% Last modified: F.L. Engel, USGS, 2/20/2013</span>
0012 
0013 
0014 <span class="comment">%% User input</span>
0015 <span class="keyword">if</span> exist(<span class="string">'plot_english'</span>) == 0
0016     plot_english = 0;  <span class="comment">%plot english units (else metric)</span>
0017     disp(<span class="string">'No units specified, plotting in metric units by default'</span>)
0018 <span class="keyword">end</span>
0019 
0020 AS = 1;  <span class="comment">%Turns on and off autoscaling (0 = off, 1 = on)</span>
0021 <span class="keyword">if</span> AS == 0
0022     MANrefvel = 25; <span class="comment">%Reference velocity in cm/s (manual setting)</span>
0023 <span class="keyword">end</span>
0024 
0025 <span class="comment">%% Parse any extra args</span>
0026 <span class="comment">%  This is used by VMT_GraphicsControl</span>
0027 <span class="keyword">if</span> any(size(varargin)&gt;0)
0028     reference_velocity = varargin{1};
0029     distance           = varargin{2};
0030     depth              = varargin{3};
0031 <span class="keyword">else</span>
0032     reference_velocity = [];
0033     distance           = [];
0034     depth              = [];
0035 <span class="keyword">end</span>
0036 
0037 <span class="comment">%% Plot the contour plot</span>
0038 <span class="keyword">if</span> isempty(z) &amp; isempty(A) &amp; isempty(V)
0039     [z,A,V,zmin,zmax,cont_log_text,fig_contour_handle] = <a href="VMT_PlotXSCont.html" class="code" title="function [z,A,V,zmin,zmax,log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english)">VMT_PlotXSCont</a>([],[],[],var,exag,plot_english);
0040 <span class="keyword">else</span>
0041     [z,A,V,zmin,zmax,cont_log_text,fig_contour_handle] = <a href="VMT_PlotXSCont.html" class="code" title="function [z,A,V,zmin,zmax,log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english)">VMT_PlotXSCont</a>(z,A,V,var,exag,plot_english);
0042 <span class="keyword">end</span>
0043 log_text = cont_log_text;
0044 
0045 <span class="comment">% if vvelcomp</span>
0046 <span class="comment">%     disp(['Plotting Secondary Flow Vector Field: ' secvecvar ' (with vertical velocity component)'])</span>
0047 <span class="comment">% else</span>
0048 <span class="comment">%     disp(['Plotting Secondary Flow Vector Field: ' secvecvar ' (without vertical velocity component)'])</span>
0049 <span class="comment">% end</span>
0050 <span class="comment">%% Plot the secondary flow quivers</span>
0051 
0052 <span class="keyword">if</span> plot_english
0053     sf = sf/0.01;  <span class="comment">%Scale factor changes with units--this makes the sf basically equal for engligh units to that for metric units</span>
0054 <span class="keyword">end</span>
0055 
0056 <span class="comment">%User input</span>
0057 
0058 clvls = 60;
0059 <span class="comment">%sf=3;       %Scale factor</span>
0060 <span class="comment">%exag=50;    %Vertical exaggeration</span>
0061 <span class="comment">%qspchorz=20;   %Vector spacing in # of ensembles</span>
0062 
0063 <span class="comment">% Misc computations</span>
0064 <span class="keyword">if</span> 0 <span class="comment">%A(1).Sup.binSize_cm == 25  %Changed some stuff below--not sure of the reason this 25 cm binsize is singled out  PRJ  (singled out due to vertical velocity bias--omit for now)</span>
0065     [I,J] = ind2sub(size(V.vp(2,:)),find(~isnan(V.vp(2,:))==1));  <span class="comment">% Use row 2 because all row 1 values are nans (WHY???--set to zero for ringing?)</span>
0066     et = J(1):qspchorz:J(end);
0067     [r c]=size(V.vp);
0068     bi = 1:2:r;  <span class="comment">%8:4:r;</span>
0069 <span class="keyword">else</span>
0070     <span class="comment">% Reference arrow</span>
0071     <span class="comment">% Find first full row of data. Typically this is row 1 with RG data,</span>
0072     <span class="comment">% however it may not be for M9 and/or RR data.</span>
0073     i = 1;
0074     <span class="keyword">while</span> any(isnan(V.vp(i,:)))
0075         i=i+1;
0076         <span class="keyword">if</span> i &gt; size(V.vp,1)
0077             <span class="keyword">break</span>
0078         <span class="keyword">end</span>
0079     <span class="keyword">end</span>
0080     
0081     <span class="comment">% If a bad ensemble exists, the above while loop might not find a</span>
0082     <span class="comment">% result. If that happens, just use row 1 anyway</span>
0083     <span class="keyword">try</span>
0084         [I,J] = ind2sub(size(V.vp(i,:)),find(~isnan(V.vp(i,:))==1));
0085     <span class="keyword">catch</span> err
0086         [I,J] = ind2sub(size(V.vp(1,:)),find(~isnan(V.vp(1,:))==1));
0087     <span class="keyword">end</span>
0088     
0089     et = J(1):qspchorz:J(end);
0090     [r c]=size(V.vp);
0091     bi = 1:qspcvert:r;
0092 <span class="keyword">end</span>
0093 
0094 <span class="comment">%zmin = floor(nanmin(nanmin(V.vp)));</span>
0095 <span class="comment">%zmax = ceil(nanmax(nanmax(V.vp)));</span>
0096 <span class="comment">%zinc = (zmax - zmin) / clvls;</span>
0097 <span class="comment">%zlevs = zmin:zinc:zmax;</span>
0098 
0099 <span class="comment">%Set the vertical velocity component</span>
0100 <span class="keyword">if</span> vvelcomp  <span class="comment">%include vertical velocity compoent in vector?</span>
0101     vertcomp = V.wSmooth;
0102 <span class="keyword">else</span>
0103     vertcomp = zeros(size(V.wSmooth));
0104 <span class="keyword">end</span>
0105 
0106 figure(fig_contour_handle); hold all
0107 <span class="comment">%quiver(V.mcsDist(bi,et),V.mcsDepth(bi,et),-sf.*V.vsSmooth(bi,et),-sf.*V.wSmooth(bi,et),0,'k')</span>
0108 <span class="keyword">switch</span> secvecvar
0109     <span class="keyword">case</span>{<span class="string">'transverse'</span>}  <span class="comment">%uses secondary velocity computed in the plane of the mean cross section (i.e. transverse)</span>
0110         vr = sqrt(abs((-sf.*V.vSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0111     <span class="keyword">case</span>{<span class="string">'secondary_zsd'</span>} <span class="comment">%Uses secondary velocity computed with a zero secondary discharge</span>
0112         vr = sqrt(abs((-sf.*V.vsSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));  
0113     <span class="keyword">case</span>{<span class="string">'secondary_roz'</span>}
0114         vr = sqrt(abs((-sf.*V.Roz.usSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0115     <span class="keyword">case</span>{<span class="string">'secondary_roz_y'</span>}
0116         vr = sqrt(abs((-sf.*V.Roz.usySmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0117     <span class="keyword">case</span>{<span class="string">'primary_roz_y'</span>}
0118         vr = sqrt(abs((-sf.*V.Roz.upySmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0119 <span class="keyword">end</span>
0120         
0121 <span class="comment">%vr=sqrt(abs(-sf.*V.vsSmooth(bi,et).^2+-sf./exag.*V.wSmooth(bi,et).^2));</span>
0122 [rw cl] = size(V.mcsDist(bi,et));
0123 toquiv(:,1) = reshape(V.mcsDist(bi,et),rw*cl,1);
0124 toquiv(:,2) = reshape(V.mcsDepth(bi,et),rw*cl,1);
0125 <span class="keyword">switch</span> secvecvar
0126     <span class="keyword">case</span>{<span class="string">'transverse'</span>}
0127         toquiv(:,3) = reshape(-sf.*V.vSmooth(bi,et),rw*cl,1); <span class="comment">%Add negative sign to reverse the +x direction (we take RHR with +x into the page lookign DS, matlab uses opposite convention)</span>
0128         refvel = ceil(max(max(abs(V.vSmooth(bi,et)))));
0129         <span class="comment">%meansecvec = mean(mean(V.vSmooth(bi,et)));</span>
0130     <span class="keyword">case</span>{<span class="string">'secondary_zsd'</span>}
0131         toquiv(:,3) = reshape(-sf.*V.vsSmooth(bi,et),rw*cl,1); <span class="comment">%Add negative sign to reverse the +x direction (we take RHR with +x into the page lookign DS, matlab uses opposite convention)</span>
0132         refvel = ceil(max(max(abs(V.vsSmooth(bi,et)))));
0133         <span class="comment">%meansecvec = mean(mean(V.vsSmooth(bi,et)));</span>
0134     <span class="keyword">case</span>{<span class="string">'secondary_roz'</span>}
0135         toquiv(:,3) = reshape(-sf.*V.Roz.usSmooth(bi,et),rw*cl,1); <span class="comment">%Add negative sign to reverse the +x direction (we take RHR with +x into the page lookign DS, matlab uses opposite convention)</span>
0136         refvel = ceil(max(max(abs(V.Roz.usSmooth(bi,et)))));
0137         <span class="comment">%meansecvec = mean(mean(V.Roz.us(bi,et)));</span>
0138     <span class="keyword">case</span>{<span class="string">'secondary_roz_y'</span>}
0139         toquiv(:,3) = reshape(-sf.*V.Roz.usySmooth(bi,et),rw*cl,1); <span class="comment">%Add negative sign to reverse the +x direction (we take RHR with +x into the page lookign DS, matlab uses opposite convention)</span>
0140         refvel = ceil(max(max(abs(V.Roz.usySmooth(bi,et)))));
0141         <span class="comment">%meansecvec = mean(mean(V.Roz.usy(bi,et)));</span>
0142     <span class="keyword">case</span>{<span class="string">'primary_roz_y'</span>}
0143         toquiv(:,3) = reshape(-sf.*V.Roz.upySmooth(bi,et),rw*cl,1); <span class="comment">%Add negative sign to reverse the +x direction (we take RHR with +x into the page lookign DS, matlab uses opposite convention)</span>
0144         refvel = ceil(max(max(abs(V.Roz.upySmooth(bi,et)))));
0145         <span class="comment">%meansecvec = mean(mean(V.Roz.upy(bi,et))));</span>
0146 <span class="keyword">end</span>
0147 toquiv(:,4) = reshape(-sf./exag.*vertcomp(bi,et),rw*cl,1);  <span class="comment">%Add negative sign to account for flipped vertical axes</span>
0148 toquiv(:,5) = reshape(vr,rw*cl,1);
0149 
0150 <span class="comment">%Ref arrow</span>
0151 <span class="keyword">if</span> isempty(distance)
0152     x1 = 0.06*max(max(V.mcsDist));
0153     x2 = 0.95*max(max(V.mcsBed));
0154     <span class="keyword">if</span> AS == 0
0155         refvel = MANrefvel; <span class="comment">%manual scaling</span>
0156     <span class="keyword">end</span>
0157 <span class="keyword">else</span>
0158     x1 = distance;
0159     x2 = depth;
0160     refvel = reference_velocity;
0161 <span class="keyword">end</span>
0162 x3=sf.*refvel; <span class="comment">%Set to rounded max secondary velocity (absolute value added 3/29/12 PRJ) (autoscaling)</span>
0163 x4=0;
0164 x5=x3;
0165 toquiv(end+1,1) = x1;
0166 toquiv(<span class="keyword">end</span>,2) = x2;
0167 toquiv(<span class="keyword">end</span>,3) = x3;
0168 toquiv(<span class="keyword">end</span>,4) = x4;
0169 toquiv(<span class="keyword">end</span>,5) = x5;
0170 <span class="comment">%quiverc(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),sf); hold on</span>
0171 
0172 <span class="keyword">if</span> plot_english
0173     unitlabel = <span class="string">'(ft/s)'</span>;
0174 <span class="keyword">else</span>
0175     unitlabel = <span class="string">'(cm/s)'</span>;
0176 <span class="keyword">end</span>
0177 
0178 <span class="keyword">if</span> plot_english <span class="comment">%english units</span>
0179     convfact = 0.03281; <span class="comment">%cm/s to ft/s</span>
0180     <span class="keyword">switch</span> var
0181         <span class="keyword">case</span>{<span class="string">'backscatter'</span>}
0182             convfact = 1.0; 
0183         <span class="keyword">case</span>{<span class="string">'flowangle'</span>}
0184             convfact = 1.0;
0185     <span class="keyword">end</span>
0186     
0187     hh = quiverc2wcmap(toquiv(:,1)*3.281,toquiv(:,2)*3.281,toquiv(:,3)*0.03281,toquiv(:,4)*0.03281,0,toquiv(:,5)*0.03281,exag);
0188     <span class="comment">%plot(V.mcsDist(1,:)*3.281,V.mcsBed*3.281,'w', 'LineWidth',2); hold on</span>
0189     ylim([0 max(V.mcsBed*3.281)])
0190     caxis([zmin*convfact zmax*convfact]) <span class="comment">%Reset the color bar to match that in the original contour plot</span>
0191     <span class="keyword">switch</span> var        
0192         <span class="keyword">case</span>{<span class="string">'streamwise'</span>}
0193             title_handle = title({[<span class="string">'Streamwise Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0194         <span class="keyword">case</span>{<span class="string">'transverse'</span>}
0195             title_handle = title({[<span class="string">'Transverse Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0196         <span class="keyword">case</span>{<span class="string">'vertical'</span>}
0197             title_handle = title({[<span class="string">'Vertical Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0198         <span class="keyword">case</span>{<span class="string">'mag'</span>}
0199             title_handle = title({[<span class="string">'Velocity Magnitude (Streamwise and Transverse) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0200         <span class="keyword">case</span>{<span class="string">'east'</span>}
0201             title_handle = title({[<span class="string">'East Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0202         <span class="keyword">case</span>{<span class="string">'error'</span>}
0203             title_handle = title({[<span class="string">'Error Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0204         <span class="keyword">case</span>{<span class="string">'north'</span>}
0205             title_handle = title({[<span class="string">'North Velocity '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0206         <span class="keyword">case</span>{<span class="string">'primary_zsd'</span>}
0207             title_handle = title({[<span class="string">'Primary Velocity (Zero Secondary Discharge Definition) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0208         <span class="keyword">case</span>{<span class="string">'secondary_zsd'</span>}
0209             title_handle = title({[<span class="string">'Secondary Velocity (Zero Secondary Discharge Definition) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0210         <span class="keyword">case</span>{<span class="string">'primary_roz'</span>}
0211             title_handle = title({[<span class="string">'Primary Velocity (Rozovskii Definition) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0212         <span class="keyword">case</span>{<span class="string">'secondary_roz'</span>}
0213             title_handle = title({[<span class="string">'Secondary Velocity (Rozovskii Definition) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0214         <span class="keyword">case</span>{<span class="string">'primary_roz_x'</span>}
0215             title_handle = title({[<span class="string">'Primary Velocity (Rozovskii Definition; Downstream Component) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>); 
0216         <span class="keyword">case</span>{<span class="string">'primary_roz_y'</span>}
0217             title_handle = title({[<span class="string">'Primary Velocity (Rozovskii Definition; Cross-Stream Component) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);       
0218         <span class="keyword">case</span>{<span class="string">'secondary_roz_x'</span>}
0219             title_handle = title({[<span class="string">'Secondary Velocity (Rozovskii Definition; Downstream Component) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);       
0220         <span class="keyword">case</span>{<span class="string">'secondary_roz_y'</span>}
0221             title_handle = title({[<span class="string">'Secondary Velocity (Rozovskii Definition; Cross-Stream Component) '</span> unitlabel];[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0222         <span class="keyword">case</span>{<span class="string">'backscatter'</span>}
0223             title_handle = title({<span class="string">'Backscatter Intensity (dB)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0224         <span class="keyword">case</span>{<span class="string">'flowangle'</span>}
0225             title_handle = title({<span class="string">'Flow Direction (deg)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0226     <span class="keyword">end</span>
0227 
0228     ylabel_handle = ylabel(<span class="string">'Depth (ft)'</span>);
0229     xlabel_handle = xlabel(<span class="string">'Distance (ft)'</span>);
0230     rf_label_pos = [0.06*max(max(V.mcsDist)) 0.9*max(max(V.mcsBed))].*3.28084; <span class="comment">% Conversion is to meters</span>
0231     ref_vector_text_handle = text(rf_label_pos(1), rf_label_pos(2),[num2str(refvel*0.03281,3) <span class="string">' ft/s'</span>],<span class="string">'FontSize'</span>,12,<span class="string">'Color'</span>,<span class="string">'w'</span>);
0232 <span class="keyword">else</span> <span class="comment">%metric units</span>
0233     hh = quiverc2wcmap(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),0,toquiv(:,5),exag);
0234     <span class="comment">%plot(V.mcsDist(1,:),V.mcsBed,'w', 'LineWidth',2); hold on</span>
0235     ylim([0 max(V.mcsBed)])
0236     <span class="comment">%Reset the color bar to match that in the original contour plot</span>
0237     <span class="keyword">if</span> strcmp(var,<span class="string">'vorticity_vw'</span>)||strcmp(var,<span class="string">'vorticity_zsd'</span>)||strcmp(var,<span class="string">'vorticity_roz'</span>)
0238         rng = zmax - zmin;
0239         caxis([-rng/2 rng/2])
0240     <span class="keyword">else</span>
0241         caxis([zmin zmax])
0242     <span class="keyword">end</span>
0243     <span class="keyword">switch</span> var        
0244         <span class="keyword">case</span>{<span class="string">'streamwise'</span>}
0245             title_handle = title({<span class="string">'Streamwise Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0246         <span class="keyword">case</span>{<span class="string">'transverse'</span>}
0247             title_handle = title({<span class="string">'Transverse Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0248         <span class="keyword">case</span>{<span class="string">'vertical'</span>}
0249             title_handle = title({<span class="string">'Vertical Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0250         <span class="keyword">case</span>{<span class="string">'mag'</span>}
0251             title_handle = title({<span class="string">'Velocity Magnitude (Streamwise and Transverse) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0252         <span class="keyword">case</span>{<span class="string">'east'</span>}
0253             title_handle = title({<span class="string">'East Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0254         <span class="keyword">case</span>{<span class="string">'error'</span>}
0255             title_handle = title({<span class="string">'Error Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0256         <span class="keyword">case</span>{<span class="string">'north'</span>}
0257             title_handle = title({<span class="string">'North Velocity (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0258         <span class="keyword">case</span>{<span class="string">'primary_zsd'</span>}
0259             title_handle = title({<span class="string">'Primary Velocity (Zero Secondary Discharge Definition) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0260         <span class="keyword">case</span>{<span class="string">'secondary_zsd'</span>}
0261             title_handle = title({<span class="string">'Secondary Velocity (Zero Secondary Discharge Definition) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0262         <span class="keyword">case</span>{<span class="string">'primary_roz'</span>}
0263             title_handle = title({<span class="string">'Primary Velocity (Rozovskii Definition) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0264         <span class="keyword">case</span>{<span class="string">'secondary_roz'</span>}
0265             title_handle = title({<span class="string">'Secondary Velocity (Rozovskii Definition) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);   
0266         <span class="keyword">case</span>{<span class="string">'primary_roz_x'</span>}
0267             title_handle = title({<span class="string">'Primary Velocity (Rozovskii Definition; Downstream Component) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0268         <span class="keyword">case</span>{<span class="string">'primary_roz_y'</span>}
0269             title_handle = title({<span class="string">'Primary Velocity (Rozovskii Definition; Cross-Stream Component) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0270         <span class="keyword">case</span>{<span class="string">'secondary_roz_x'</span>}
0271             title_handle = title({<span class="string">'Secondary Velocity (Rozovskii Definition; Downstream Component) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);       
0272         <span class="keyword">case</span>{<span class="string">'secondary_roz_y'</span>}
0273             title_handle = title({<span class="string">'Secondary Velocity (Rozovskii Definition; Cross-Stream Component) (cm/s)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0274         <span class="keyword">case</span>{<span class="string">'backscatter'</span>}
0275             title_handle = title({<span class="string">'Backscatter Intensity (dB)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0276         <span class="keyword">case</span>{<span class="string">'flowangle'</span>}
0277             title_handle = title({<span class="string">'Flow Direction (deg)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0278         <span class="keyword">case</span>{<span class="string">'vorticity_vw'</span>}
0279             title_handle = title({<span class="string">'Streamwise Vorticity'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0280         <span class="keyword">case</span>{<span class="string">'vorticity_zsd'</span>}
0281             title_handle = title({<span class="string">'Streamwise Vorticity (Zero Secondary Discharge Definition)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0282         <span class="keyword">case</span>{<span class="string">'vorticity_roz'</span>}
0283             title_handle = title({<span class="string">'Streamwise Vorticity (Rozovskii Definition)'</span>;[<span class="string">'with secondary flow vectors ('</span> secvecvar <span class="string">')'</span>]},<span class="string">'Interpreter'</span>,<span class="string">'none'</span>);
0284     <span class="keyword">end</span>
0285 
0286     ylabel_handle = ylabel(<span class="string">'Depth (m)'</span>);
0287     xlabel_handle = xlabel(<span class="string">'Distance (m)'</span>);
0288     rf_label_pos = [0.06*max(max(V.mcsDist)) 0.9*max(max(V.mcsBed))]; 
0289     ref_vector_text_handle = text(rf_label_pos(1), rf_label_pos(2),[num2str(refvel) <span class="string">' cm/s'</span>],<span class="string">'FontSize'</span>,12,<span class="string">'Color'</span>,<span class="string">'w'</span>);
0290 <span class="keyword">end</span>
0291 
0292 <span class="comment">% Tag the elements in the figure</span>
0293 secondary_vector_handles = findobj(gcf,<span class="string">'Type'</span>,<span class="string">'line'</span>,<span class="string">'-not'</span>,<span class="string">'tag'</span>,<span class="string">'PlotBedElevation'</span>);
0294 set(secondary_vector_handles,       <span class="string">'Tag'</span>,<span class="string">'SecondaryVectors'</span>)
0295 set(ref_vector_text_handle,         <span class="string">'Tag'</span>,<span class="string">'ReferenceVectorText'</span>)
0296 set(title_handle,                   <span class="string">'Tag'</span>,<span class="string">'ContourPlotTitle'</span>)
0297 set(ylabel_handle,                  <span class="string">'Tag'</span>,<span class="string">'yLabelText'</span>)
0298 set(xlabel_handle,                  <span class="string">'Tag'</span>,<span class="string">'xLabelText'</span>)
0299 
0300 <span class="comment">% Adjust the plot</span>
0301 set(gca,<span class="keyword">...</span>
0302     <span class="string">'DataAspectRatio'</span>,   [exag 1 1],<span class="keyword">...</span>
0303     <span class="string">'PlotBoxAspectRatio'</span>,[exag 1 1]<span class="keyword">...</span>
0304     <span class="keyword">...</span><span class="comment">'FontSize',          14)</span>
0305     )
0306 <span class="comment">% set(get(gca,'Title'),   'FontSize',14,'Color','w')</span>
0307 <span class="comment">% set(get(gca,'xlabel'),  'FontSize',14,'Color','w')</span>
0308 <span class="comment">% set(get(gca,'ylabel'),  'FontSize',14,'Color','w')</span>
0309 <span class="comment">% set(gca,...</span>
0310 <span class="comment">%     'XColor','w',...</span>
0311 <span class="comment">%     'YColor','w',...</span>
0312 <span class="comment">%     'ZColor','w',...</span>
0313 <span class="comment">%     'Color',[0.3 0.3 0.3])</span>
0314 <span class="comment">% set(gcf,...</span>
0315 <span class="comment">%     'InvertHardCopy','off',...</span>
0316 <span class="comment">%     'Color','k')</span>
0317 <span class="keyword">if</span> 1  <span class="comment">%Set the vector line widths</span>
0318     VectorLineWidth = 1.0;
0319     set(secondary_vector_handles  ,<span class="string">'LineWidth'</span>,VectorLineWidth)
0320 <span class="keyword">end</span>
0321 
0322 
0323 
0324 <span class="comment">% scrsz = get(0,'ScreenSize');</span>
0325 <span class="comment">% figure('OuterPosition',[1 scrsz(4) scrsz(3) scrsz(4)])</span>
0326 
0327 <span class="comment">%Display the ratio of the mean secondary and primary velocity magnitudes</span>
0328 spratio_zsd = nanmedian(nanmedian(abs(V.vs)))./nanmedian(nanmedian(abs(V.vp)));
0329 spratio_roz = nanmedian(nanmedian(abs(V.Roz.usy)))./nanmedian(nanmedian(abs(V.Roz.up)));
0330 <span class="comment">% disp(['Ratio of median Secondary to median Primary Velocity (zsd) = ' num2str(spratio_zsd)])</span>
0331 <span class="comment">% disp(['Ratio of median Secondary to median Primary Velocity (roz) = ' num2str(spratio_roz)])</span>
0332 log_text = vertcat(log_text,<span class="keyword">...</span>
0333     {[<span class="string">'   Ratio of median Secondary to median Primary Velocity (zsd) = '</span> num2str(spratio_zsd)];<span class="keyword">...</span>
0334     [<span class="string">'   Ratio of median Secondary to median Primary Velocity (roz) = '</span> num2str(spratio_roz)]}<span class="keyword">...</span>
0335     );
0336 
0337 <span class="keyword">return</span>
0338 
0339 
0340 <span class="comment">%Add labels to the reference arrow and colorbar</span>
0341 <span class="comment">% text(50,12,['Vertical Distances Exaggerated by ',num2str(exag)],'FontSize',16)</span>
0342 <span class="comment">% text(140,17,'10 cm/s','FontSize',16)</span>
0343</pre></div>
<hr><address>Generated on Wed 04-Jun-2014 14:21:02 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>